<!DOCTYPE html>
<html lang="en">
<script type="text/javascript">
    var dire = 'user';
    var thumb = 'big_thumb,middle_thumb,small_thumb';
    var fileNumLimit = 1;
</script>

<head>
    <{include file="header.html" }>
        <title>发布直播课-课程管理-
            <{$user_data[ 'school_name']}>-德安信会计在线教育平台</title>
        <!-- <link href="/static/public/webupload/webuploader.css" rel="stylesheet"> -->
</head>

<body>
    <div class="wrap">
        <!--star left-->
        <div class="column">
            <{include file="left_menu.html" }>
        </div>
        <div id="ContMianBox">
            <!--star子栏目-->
            <div class="sub-colum">
                <div class="tit"><{$left_menu_min.menu}></div>
                <ul>
                    <{foreach from=$left_menu_min.list item=item}>
                    <li <{if $item['url'] == $left_menu_min.curr}>class="curr"<{/if}>><a href="<{$item['url']}>"><{$item['name']}></a></li>
                    <{/foreach}>
                </ul>
            </div>
            <!--end子栏目-->
            <!--end left-->
            <div class="container narrow">
                <!--star conter-->
                <div class="cetContent">
                    <div class="tit p-lr20">
                        <a class="c-40d064" href="/course_zhibo">直播课</a><em class="p-lr10 c-CCCCCC fs12">/</em><em>发布直播课</em>
                    </div>
                </div>
                <!--star内容区域-->
                <div class="mainScroll">
                    <div class="mainContainer line-all">
                        <!--star tabMainCont-->
                        <div class="line-all p20">
                            <!-- <input type="hidden" id="token" value="<{$token}>"> -->
                            <form class="layui-form" method="post" action="<{$post_url}>" onsubmi="return false" id="form_add_video_course">
                                <input type="hidden" name="id" value="<{$info.id|default:'0'}>" />
                                <div class="layui-form-item">
                                    <label class="layui-form-label">课程分类：</label>
                                    <div class="layui-input-inline">
                                        <select name="cate_id" lay-verify="required" id="cate_id" placeholder="请选择" lay-filter="cate_id">
                                            <option value="">课程分类</option>
                                            <{foreach from=$cate item=item}>

                                                <option value="<{$item.id}>" <{if $info['cate_id']|default:"" eq $item.id}>selected="selected"<{/if}>><{$item.name}></option>
                                            <{/foreach}>
                                        </select>
                                    </div>
                                    <div class="layui-form-mid layui-word-aux"><{if empty($cate)}>还没有课程分类，请<a href="/course_zhibo/cate_publish" class="c-52a1fa">添加课程分类</a><{/if}></div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">课程科目：</label>
                                    <div class="layui-input-inline">
                                        <select name="subject_id" lay-verify="required" id="subject" placeholder="请选择" lay-filter="subject">
                                            <option value="">请选择科目</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">老师：</label>
                                    <div class="layui-input-inline">
                                        <select name="teacher_id" lay-verify="required" id="teacher" placeholder="请选择" lay-filter="teacher">
        								<{foreach from=$teacher item=item}>
        									<option value=""></option>
        									<option value="<{$item.id}>" <{if $info['teacher_id']|default:"" eq $item.id}>selected="selected"<{/if}>><{$item.teacher_name}></option>
        								<{/foreach}>
        							</select>
                                    </div>
                                    <div class="layui-form-mid layui-word-aux">从学校老师中选择，为添加老师请先添加，　<a href="/teacher/teacher_add"  class="c-52a1fa">添加老师</a></div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">标题</label>
                                        <div class="layui-input-block">
                                            <input type="text" value="<{$info.title|default:''}>" name="title" placeholder="请输入标题" lay-verify="required" autocomplete="off" class="layui-input" style="width: 800px;">
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">课程封面：</label>
                                    <input type="hidden" id="token" value="<{'VIMG'|get_qiniu_token}>" />
                                    <div class="layui-input-block">
                                        <div id="uploader2" class="upload_box" style="float:left; width:420px;">
                                        <div class="queueList">
                                            <div id="dndArea2" class="placeholder dndArea">
                                                <div id="filePicker2" class="filePicker"></div>
                                                <p>或将照片拖到这里，最多可上传<script>document.write(fileNumLimit);</script>张图片</p>
                                            </div>
                                        </div>
                                        <div class="statusBar" style="display:none;">
                                            <div class="progress">
                                                <span class="text">0%</span>
                                                <span class="percentage"></span>
                                            </div><div class="info"></div>
                                            <div class="btns">
                                                <div id="filePickerBut2" class="filePickerBut"></div><div class="uploadBtn">开始上传</div>
                                            </div>
                                        </div>
                                        <div class="upload_img_input" input_name='img_url[]'></div>
                                    </div>
                                       
                                        <{if isset($img_url_err)}>
                                            <i class="layui-icon" style="font-size: 30px; color: red">&#x1007;</i>
                                            <span class="tip" style=" padding:2px 5px;"><{$img_url_err}></span>
                                        <{/if}>
                                        <div class="layui-form-mid layui-word-aux">
                                        <{if !empty($info.course_img)}><img src="<{$info.course_img}>" style="max-height: 155px;"><br><{/if}>
                                        提示：班课图片尺寸建议：400*300(4:3)，最多上传6张，第一张为主图
                                        
                                                </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">时长:</label>
                                    <div class="layui-input-inline">
                                        <input type="number" value="<{$info.course_time|default:''}>" placeholder="课长,单位分钟" name="course_time" lay-verify="required" autocomplete="off" class="layui-input">
                                    </div>
                                    <div class="layui-form-mid layui-word-aux">单位小时</div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">开始直播：</label>
                                    <div class="layui-input-inline">
                                        <input class="layui-input" value="<{$info.start_time|date_format:'%Y-%m-%d %H:%M:%S'|default:''}>" name="start_time" placeholder="开始时间" onclick="layui.laydate({elem: this, istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
                                    </div>
                                    <div class="layui-form-mid">-</div>
                                    <div class="layui-input-inline">
                                        <input class="layui-input" value="<{$info.end_time|date_format:'%Y-%m-%d %H:%M:%S'|default:''}>" name="end_time" placeholder="截止时间" onclick="layui.laydate({elem: this, istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">价格:</label>
                                    <div class="layui-input-inline">
                                        <input type="text" value="<{$info.price|default:''}>" placeholder="请输入价格" name="price" lay-verify="required" autocomplete="off" class="layui-input">
                                    </div>
                                    <div class="layui-form-mid layui-word-aux">元</div>
                                </div>
                                <!-- <div class="layui-form-item">
                                    <label class="layui-form-label">有效期:</label>
                                    <div class="layui-input-inline">
                                       <input type="text" placeholder="请输入有效期" name="effective_time" lay-verify="required" autocomplete="off" class="layui-input">
                                    </div>
                                    <div class="layui-form-mid layui-word-aux">天</div>
                                </div> -->
                                <div class="layui-form-item">
                                    <label class="layui-form-label">适合人群:</label>
                                    <div class="layui-input-block">
                                        <input type="text" value="<{$info.suitable|default:''}>" name="suitable" lay-verify="required" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">课程收益:</label>
                                    <div class="layui-input-block">
                                        <input type="text" value="<{$info['learn_what']|default:""}>" placeholder="请输入学到什么" name="learn_what" lay-verify="required" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item layui-form-text">
                                    <label class="layui-form-label">课程详情：</label>
                                    <div class="layui-input-block">
                                        <textarea name="detail" id="detail" placeholder="请输入详情" class="editor layui-textarea"><{$info.detail|default:''}></textarea>
                                    </div>
                                </div>
                                <div class="layui-input-block">
                                    <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
                                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                </div>
                            </form>
                            <!--end tabMainCont-->
                        </div>

                    </div>
                </div>
                <{include file="footer.html"}>
                <!--end内容区域-->
                <!-- <script type="text/javascript" src="/static/public/webupload/webuploader.js"></script> -->
                <!-- <script type="text/javascript" src="/static/public/webupload/upload.js"></script> -->
                <!-- <script type="text/javascript" src="/static/public/webupload/upload_for_school.js"></script> -->
                <!-- <script>
                    layui.use('laydate', function() {
                        var laydate = layui.laydate;

                        var start = {
                            min: laydate.now(-30),
                            max: laydate.now(+365),
                            istoday: false,
                            choose: function(datas) {
                                end.min = datas; //开始日选好后，重置结束日的最小日期
                                end.start = datas //将结束日的初始值设定为开始日
                            }
                        };

                        var end = {
                            min: laydate.now(),
                            max: laydate.now(+365),
                            istoday: false,
                            choose: function(datas) {
                                start.max = datas; //结束日选好后，重置开始日的最大日期
                            }
                        };

                        document.getElementById('LAY_demorange_s').onclick = function() {
                            start.elem = this;
                            laydate(start);
                        }
                        document.getElementById('LAY_demorange_e').onclick = function() {
                            end.elem = this
                            laydate(end);
                        }

                    });
                </script> -->

                <script>
                    $(function() {

                        layui.use(['form','layedit','jquery'], function() {
                            var form = layui.form();
                            $ = layui.jquery;

                            //监听提交
                            form.on('submit(formDemo)', function(data) {
                                layer.msg(JSON.stringify(data.field));
                                return false;
                            });
                            form.on('select(cate_id)', function(data){
                                var ii = layer.load();
                                var id = data.value;
                                $("#course_id").html('<option value="">请选择科目</option>');
                                form.render('select');
                                $.ajax({
                                    type: "POST",
                                    url: "/course/get_cate_subject",
                                    data: {id:id},
                                    dataType: "json",
                                    success: function (data) {
                                        var ddl = $("#subject");
                                        var html ='<option value="">请选择科目</option>';
                                        $(data).each(function (key) {
                                            html += "<option value='"+data[key].id+"'>"+data[key].name+"</option>";
                                        });
                                        $("#subject").html(html);
                                        form.render('select');
                                        layer.close(ii);
                                    }
                                });

                            });
                            if("<{$info['cate_id']|default:0}>" > 0){
                                var ii = layer.load();
                                var id = "<{$info['cate_id']|default:0}>";
                                var subject_id = "<{$info['subject_id']|default:0}>";
                                $("#course_id").html('<option value="">请选择科目</option>');
                                form.render('select');
                                $.ajax({
                                    type: "POST",
                                    url: "/course/get_cate_subject",
                                    data: {id:id},
                                    dataType: "json",
                                    success: function (data) {
                                        var ddl = $("#subject");
                                        var html ='<option value="">请选择科目</option>';
                                        $(data).each(function (key) {
                                            if(data[key].id == subject_id){
                                                html += "<option value='"+data[key].id+"' selected='selected'>"+data[key].name+"</option>";
                                            }else{
                                                html += "<option value='"+data[key].id+"'>"+data[key].name+"</option>";
                                            }
                                            
                                        });
                                        $("#subject").html(html);
                                        form.render('select');
                                        layer.close(ii);
                                    }
                                });
                            }
                        });


                    })
                    
                </script>
